import {showLoadingToast} from 'vant';

export default {
  isLoading: false,
  instance: undefined,
  loading() {
    if (this.isLoading) return;
    this.isLoading = true
    this.instance = showLoadingToast({
      allowMultipleToast: true,
      message: '加载中...',
    });
  },

  loaded() {
    this.isLoading = false;
    try {
      this.instance.close();
    } catch (e) {
      console.error(e);
    }
  },
};